package apache.commons.beanutils;

import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;

public class BeanUtilsTest {

    /**
     * 比较坑的问题使用单元测试时死活跑正确
     * @param args
     */
    public static void main(String[] args) {
        Map map = new HashMap<>();
        map.put("id", 1000);
        map.put("user_name", "smqk");

        User user = new User();
        try {
            BeanUtils.populate(user, map);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        System.out.println(user);
    }
}
